<h2> Edit a node</h2>
<% if @node %>
    <ul>
        <%= form_for @node, :url => { :action => :update } do |f| %>
            <%= f.label :name, "Name:" %>
            <%= f.text_field :name%><br />
            <p><%= f.submit "Submit", :disable_with => 'Submitting...' %></p>
        <% end %>
    </ul>
        <%= link_to "Delete #{@node.name}.", controller: :taxonomite, action: :destroy, id: @node.id %>
    <ul>

    </ul>

    <% if !@node.is_root? %>
    <h3>Parent:</h3>
    <ul>
        <li><%= link_to @node.parent.name, taxonomite_path(@node.parent) %>
            <%= link_to 'break', ['node', :breakparent, :id => @node] %></li>
    </ul>
    <% end %>

    <% if !@node.is_leaf? %>
    <h3>Children:</h3>
    <ul>
        <% for child in @node.children do %>
            <li><%= link_to child.name, taxonomite_path(child) %>
                <%= link_to 'Remove', ['node', :remchild, :node => child] %></li>
        <% end %>
    </ul>
    <% end %>

    <h3>Add children:</h3>
    <ul>
        <% for p in Taxonomite::Node.all.each do %>
            <% unless p == @node || @node.children.find(p) %>
                <li><%= p.name %>  (<%= p.entity_type %>) -- <%= link_to 'Add', ['node', :addchild, :node => p] %></li>
            <% end %>
        <% end %>
    </ul>

<% else %>
    <p>Unable to find a node.</p>
<% end %>
